package net.wickywicky.ps12;

import java.util.Iterator;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class BandActivity extends Activity {
	private PS12DataHelper datahelper;
	
    /** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);
	  datahelper = new PS12DataHelper(this);
	// We'll define a custom screen layout here (the one shown above), but
      // typically, you could just use the standard ListActivity layout.
      setContentView(R.layout.band);
      
      Bundle extras = getIntent().getExtras();
      if(extras !=null) {
    	  TextView tv = (TextView)findViewById(R.id.bandName);
    	  tv.setText( extras.getString("band_name") );
      }
      
      LinearLayout ll = (LinearLayout)findViewById(R.id.gigs);
      List<String> giglist = datahelper.getBandGigs(extras.getString("band_name"));
	  Iterator<String> iterator = giglist.iterator();
      while(iterator.hasNext()){
    	  TextView tv = new TextView(this);
    	  tv.setText(iterator.next());
    	  ll.addView(tv);
      }
      
	};
}
